package com.vcc.service.boss.response.rate;

import com.vcc.service.boss.response.baseVo.BossBaseVo;
import com.vcc.core.util.DateUtil;
import com.vcc.data.entity.UserRate;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;

@EqualsAndHashCode(callSuper = true)
@Data
@Getter
@Setter
public class UserRateVoBoss extends BossBaseVo implements Serializable {

    @NotNull(message = "用户ID不能为空")
    private Long userId;

    @Min(value = 0, message = "费率不能小于0")
    private BigDecimal rate;

    @Min(value = 0, message = "提现费率不能小于0")
    private BigDecimal clearRate;

    @Min(value = 0, message = "活动费率不能小于0")
    private BigDecimal activityRate;

    private String activityStartDate;

    private String activityEndDate;


    public UserRateVoBoss() {
    }

    public UserRateVoBoss(UserRate userRate) {
        super.setId(userRate.getId());
        this.userId = userRate.getUserId();
        setCreateDate(userRate.getCreateDate());
        this.rate = userRate.getRate();
        this.clearRate = userRate.getClearRate();
        this.activityRate = userRate.getActivityRate();
        this.activityStartDate = userRate.getActivityStartDate() != null ? DateUtil.format(userRate.getActivityStartDate()) : "";
        this.activityEndDate = userRate.getActivityEndDate() != null ? DateUtil.format(userRate.getActivityEndDate()) : "";
    }

}
